package com.gemme.gemme.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.gemme.gemme.R;
import com.gemme.gemme.home.ProductListBean;

public class TopIvBottomTextView extends RelativeLayout {
    private Context context;
    public TopIvBottomTextView(Context context) {
        this(context,null);
    }

    public TopIvBottomTextView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public TopIvBottomTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }
    ImageView iv_picture;
    TextView tv_name;
    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.top_iv_bottom_tv,this);
        iv_picture = findViewById(R.id.iv_picture);
        tv_name = findViewById(R.id.tv_name);

    }

    public void setData(ProductListBean.DataBean.CategoryVoListBean categoryVoListBean) {
        try {
            tv_name.setText(categoryVoListBean.getCategoryName());
            Glide.with(context).load(categoryVoListBean.getCategoryImg()).into(iv_picture);
        }catch (Exception e){

        }
    }
}
